home *** CD-ROM | disk | FTP | other *** search
- Path: news.rain.org!usenet
- From: "Guus Leeuw jr." <guusl@eiffel.com>
- Newsgroups: comp.lang.c++
- Subject: Re: How to generate all the combinations of n numbers?
- Date: Fri, 23 Feb 1996 14:32:54 -0800
- Organization: Interactive Software Engineering Inc. http://www.eiffel.com/
- Message-ID: <312E4096.9456B1A@eiffel.com>
- References: <4giuc9$pq@news.cis.okstate.edu>
- NNTP-Posting-Host: @outback.eiffel.com
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 2.0 (X11; I; Linux 1.2.8 i586)
- CC: kakani@osuunx.ucc.okstate.edu
-
- Madhav Kakani wrote:
- >
- > Hello everybody,
- > I am having problems in writing a c/c++ program which
- > generates all possible combinations of n given numbers.
- > For example, if an array x has some numbers
- >
- > int x[] = {1,2,3};
- >
- > the program should generate the following output:
- > 1
- > 2
- > 3
- > 12
- > 13
- > 23
- > 123
-
- Assignment, huh?
-
- Well, two things:
-
- a) we don't do that. Ya gotta come up with your example code an we'll go
- from there (if there's any not obvious problem)
-
- b) How did you write the above list anyways? Is there some method that
- has been followed? If so, try to implement that method. (I see
- immediately some method that you followed...)
-
- Regards,
- Guus
-